#include "stdio.h"
#define MAX 100

void test1() {
    FILE *f1 = fopen("files/data.txt", "r");
    FILE *f2 = fopen("files/data_copy.txt", "w");

    char chs[MAX];
    while (fgets(chs, MAX, f1) != NULL) {
        fputs(chs, f2);
    }

    fclose(f1);
    fclose(f2);
    FILE *f3 = fopen("files/data_copy.txt", "r");
    while (fgets(chs, MAX, f3) != NULL) {
        printf("%s", chs);
    }
}

int main() {
    void (*test[])() = {test1};
    int n = sizeof(test) / sizeof(*test);
    for (int i = 0; i < n; i++) {
        printf("test %d ============\n", i);
        test[i]();
    }
    return 0;
}